#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <limits.h>

#define N 10000000


int pontos_in;
int pontos_total;

const unsigned int num = 1664525, num2 = 1013904223;

unsigned int rand_function(unsigned int x)
{
        return x*num+num2;
}

void calcula(){

    double x,y;
    srand(time(NULL));
    unsigned int aux = time(NULL);

    pontos_in = pontos_total = 0;

    while(pontos_total < N){

    aux = rand_function(aux);
    x = (double) aux/UINT_MAX;
    aux = rand_function(aux);
    y = (double) aux/UINT_MAX;

    //printf("%lf   %lf\n",x,y);


    if((x*x) + (y*y) <= 1){
        pontos_in++;
        }

    pontos_total++;

    }
}

void monteCarloSeq(void){
    double pi;

    calcula();

    pi = 4.0*((((double)pontos_in))/((double)pontos_total));

    printf("%lf",pi);
}




